package com.gps.web.dao.system;

import org.hibernate.criterion.Restrictions;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;

import com.gps.web.comm.dao.BaseDaoBean;
import com.gps.web.entity.system.User;

@Repository
public class UserDaoBean extends BaseDaoBean<User, Integer> implements
		UserDao {

	@Override
	@Transactional
	public User AttemptLogin(String loginName, String passWord) {
		java.util.List<User> list = findByCriteria(
				Restrictions.eq("userName", loginName),
				Restrictions.eq("passWord", passWord));

		if (list != null && list.size() > 0) {
			return list.get(0);
		}
		return null;
	}

}
